-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harmonise core/boot-psm.js
with core/boot.js
#6568
Conversation
I tried the steps to reproduce from #6490 ; it doesn't look fixed.
|
Ahh, yes. That's because there's an instance per brand pair. Try |
options = {}, | ||
{ env = process.env } = {}, | ||
) => { | ||
const { ROLE = env.ROLE || 'chain', econCommitteeOptions } = options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to pass process.env
than rely on ambient authority, but why pass it at all if it can come in through options.ROLE
? Multiple ways to express the same configuration makes the code harder to follow. It's not apparent without reading committeeProposalBuilder
that env.ROLE
is valid or takes precedence over options.ROLE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out ROLE
was unnecessary. Removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to still be there as of 2a2b288
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to still be there
I need to push. I'll rerequest your review when I do.
@@ -71,15 +71,16 @@ const installKeyGroups = { | |||
* @param {(m: string, b: string, opts?: any) => I} opts.install | |||
* @param {<T>(f: T) => T} [opts.wrapInstall] | |||
* | |||
* @param options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param options | |
* @param {{ ROLE: 'chain' | 'whatever else', econCommitteeOptions: ??? }} options |
[voterInvitation, nullInvitation], | ||
[ | ||
invitationP, | ||
// TODO: This null invitation is used just to identify the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO by when? Ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ restoreRef }, | ||
{ installKeys }, | ||
) => { | ||
const { [installGovAndPSMContracts.name]: _toss, ...manifest } = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't simply _
the convention here for ignoring a param?
const { [installGovAndPSMContracts.name]: _toss, ...manifest } = | |
const { [installGovAndPSMContracts.name]: _, ...manifest } = |
payments.map(async (paymentP, i) => { | ||
const payment = await paymentP; | ||
await E(depositFacet).receive(payment); | ||
console.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice diagnostic info
|
||
return E(namesByAddressAdmin).update(address, nameHub, myAddressNameAdmin); | ||
// Don't clobber an existing myAddressNameAdmin or deposit facet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will silently fail if publishDepositFacet
is called a second time and wallet.getDepositFacet()
changes.
This does seem like an improvement to make it immutable, but shouldn't we error if something tries to change it? At least log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More like it silently succeeds, yes?
This is saying "if there's already one there, leave it alone. Otherwise, use this one"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Success or failure depends on the intent ;-)
My point is: if what's already there doesn't match, isn't that a surprise? In what cases would you expect the existing value to be different than the new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what cases would you expect the existing value to be different than the new one?
In case an ag-solo already registered it.
isn't that a surprise?
Not any longer, IIUC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add documentation to this effect.
@@ -0,0 +1,30 @@ | |||
import { makeHelpers } from '@agoric/deploy-script-support'; | |||
|
|||
export const defaultProposalBuilder = async ({ publishRef, install }) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is "default" here meant like "default export" or are there expected to be multiple proposal builders in a module like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coreProposals
swingset config feature uses defaultProposalBuilder
by default (i.e. if the config file does not specify a different entrypoint).
BRIDGE_ID.PROVISION_SMART_WALLET, | ||
obj, | ||
); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is assuming the if SMART_WALLET
isn't in the powerFlags that it should do this. why not validate the contents? I'm thinking the final else
should be an error for an undefined case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please be more specific? What kind of validation do you expect, since the Golang side of things already enforces that powerFlags
is an array of strings?
I should have been clear: yes, I did that too. There are no PSMs
|
I see PSMs now:
fyi, @thisispalash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/agoric-cli/src/start.js
Outdated
const coreConfigPath = path.resolve( | ||
'node_modules/@agoric/vats/decentral-core-config.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to assume that the current working directory has node_modules
with the @agoric/vats
package installed. That seems to be a new assumption. I suppose it's justified by the way agoric install
works?
Elsewhere I've see a function that resolves paths like @agoric/vats/decentral-core-config.json
. I'm not sure why we don't use it here.
But I don't feel strongly about it. The whole agoric-cli
package seems to be a bit of a wild west w.r.t. ocap discipline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependency on node_modules
was ugly and unnecessary, so I've now abstracted it behind require.resolve
.
"provisioning": { | ||
"sourceSpec": "@agoric/vats/src/vat-provisioning.js" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this calls for re-opening #5965 to think it over again.
"priceAuthority": { | ||
"sourceSpec": "@agoric/vats/src/vat-priceAuthority.js" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does vat-priceAuthority.js
belong here rather than in a vaults proposal?
(semi-rhetorical; I suppose I could figure it out if I looked around.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vat-priceAuthority.js
is not a Zoe contract, so doesn't easily fit into the current way proposals are implemented. But yes, ideally it would be part of a proposal, and we would make a separate decision whether to publish it to solo clients.
"ibc": { | ||
"sourceSpec": "@agoric/vats/src/vat-ibc.js" | ||
}, | ||
"network": { | ||
"sourceSpec": "@agoric/vats/src/vat-network.js" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivanlei the list of vats/contracts that I put together Nov 9 for planning purposes didn't include these two (ibc, network). I suppose they should be added to the list of things to make upgradeable (#6553). Ah... we already have #5696 for the network vat. I don't know whether we included it in any plans.
options = {}, | ||
{ env = process.env } = {}, | ||
) => { | ||
const { ROLE = env.ROLE || 'chain', econCommitteeOptions } = options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to still be there as of 2a2b288
{ restoreRef }, | ||
{ installKeys }, | ||
) => { | ||
const { [installGovAndPSMContracts.name]: _toss, ...manifest } = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing installGovAndPSMContracts
from the manifest returned by getManifestForPsmGovernance
? It seems particularly relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The installations
property below subsumes what installGovAndPSMContracts
does.
@@ -108,7 +108,8 @@ const startGovernedInstance = async ( | |||
* }>} powers | |||
* @param {{ | |||
* options?: { | |||
* perAccountInitialValue?: bigint | |||
* perAccountInitialValue?: bigint, | |||
* walletBridgeId?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* walletBridgeId?: string | |
* walletBridgeId?: string, |
06c2df6
to
65be26a
Compare
65be26a
to
12ba2c6
Compare
81f7dbc
to
77c5d31
Compare
77c5d31
to
6759d4d
Compare
ce038b9
to
140986f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still looks good.
I have a few wishes...
const { nickname, address, powerFlags: rawPowerFlags } = obj; | ||
const powerFlags = rawPowerFlags || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we usually write it this way?
const { nickname, address, powerFlags: rawPowerFlags } = obj; | |
const powerFlags = rawPowerFlags || []; | |
const { nickname, address, powerFlags = [] } = obj; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- wish: unit test
- wish: pattern-based dynamic type check on
obj
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that obj.powerFlags
can be null
. The destructuring default values only work if obj.powerFlags
is undefined
.
Yeah, the dynamic checks would be better with patterns.
@@ -146,9 +147,24 @@ export const bridgeProvisioner = async ({ | |||
async fromBridge(_srcID, obj) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does fromBridge
here relate to the one in provisionPool.js
? I'd like to see compare/contrast comments on each.
@@ -690,8 +690,7 @@ ${chainID} chain does not yet know of address ${clientAddr}${adviseEgress( | |||
console.debug(`helper said: ${stdout}`); | |||
const out = JSON.parse(stdout); | |||
|
|||
out.code || | |||
0 || | |||
out.code === 0 || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes. that looks like it was hairy to track down.
wish: unit test
provisionP = E(bridgeManager).fromBridge( | ||
BRIDGE_ID.PROVISION_SMART_WALLET, | ||
obj, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this message actually end up? I do not see any bridge handler registered for it since boot-psm
sets walletBridgeId
to BridgeId.PROVISION
.
closes: #6490
#loadgen-branch: mfig-diagnostics
Description
Merge the changes from the
core/boot-psm.js
mechanism used in the first Agoric VM deployment with the manifest-basedcore/boot.js
system.Security Considerations
Documentation Considerations
Testing Considerations
The
devnet
configuration is now tested by the cosmic-swingset integration tests.